package arduino.controller.editors;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;

import commons.ui.editor.StatusEditorPart;
import commons.ui.widget.StringControl;

public class ArduinoSetupEditor extends StatusEditorPart {

    public static final String ID = "arduino.controller.editors.ArduinoSetupEditor";
    private StringControl _shortDescription;
    private final boolean _permitted = true;
    private final ModifyListener _dirtyValidateListener = new ModifyListener() {
	@Override
	public void modifyText(ModifyEvent event) {

	}
    };

    public ArduinoSetupEditor() {
	super();
    }

    @Override
    public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	super.init(site, input);
	setPartName("Arduino");
    }

    @Override
    public void doSave(IProgressMonitor monitor) {
	// TODO Auto-generated method stub

    }

    @Override
    public void doSaveAs() {
	// TODO Auto-generated method stub

    }

    @Override
    public boolean isDirty() {
	// TODO Auto-generated method stub
	return false;
    }

    @Override
    public boolean isSaveAsAllowed() {
	// TODO Auto-generated method stub
	return false;
    }

    @Override
    public void createPartControl(Composite parent) {
	Group descriptionGroup = new Group(parent, SWT.NULL);
	descriptionGroup.setLayout(new GridLayout(2, false));
	descriptionGroup.setText("Monitor Parameters"); //$NON-NLS-1$

	new Label(descriptionGroup, SWT.NULL).setText("Required Parameter");
	_shortDescription = new StringControl(descriptionGroup, SWT.BORDER);
	_shortDescription.setColumns(35);
	_shortDescription.setTextLimit(50);
	_shortDescription.setRequired(_permitted);
	_shortDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	_shortDescription.setEditable(_permitted);
	_shortDescription.addModifyListener(_dirtyValidateListener);

	//
    }

    @Override
    public void setFocus() {
	// TODO Auto-generated method stub

    }

}
